package com.jams.goodox.widget.decoration;

import android.graphics.Rect;
import android.support.v7.widget.RecyclerView;
import android.view.View;

/**
 * Created by Jin on 2016/9/23.
 * Description
 */
public class SpaceItemGridLayoutDecoration extends RecyclerView.ItemDecoration {

	private int space;

	public SpaceItemGridLayoutDecoration(int space) {
		this.space = space;
	}

	@Override
	public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
		outRect.top = space;
		if (parent.getChildAdapterPosition(view) % 2 == 1) outRect.left = space;
	}
}
